<article class="cl pd-20">
    <form action="" method="post" class="form form-horizontal" id="form-save">
        <input type="hidden" name="userid" id="userid" value="{$data.userid}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>手机号：</label>
            <div class="formControls col-xs-8 col-sm-6">
                <span>{$data.username}</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                重置密码：</label>
            <div class="formControls col-xs-8 col-sm-6">
                <input type="password" class="input-text" id="password" name="password" value=""
                    placeholder="6位及以上, 至少包括字母和数字" autocomplete="password">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                昵称: </label>
            <div class="formControls col-xs-8 col-sm-6">
                <input type="text" class="input-text" id="nickname" name="nickname" value="{$data.nickname}"
                    placeholder="昵称">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                用户组：</label>
            <div class="formControls col-xs-4 col-sm-4">
                <span class="select-box" style="width:150px;">
                    <select class="select" id="groupid" name="groupid" title="group">
                        {foreach $dataGroup as $k=>$op}
                        <option value="{$k}" {eq name="data.groupid" value="$k" }selected{/eq}>{$op}</option>
                        {/foreach}
                    </select>
                </span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red"></span>状态：</label>
            <div class="formControls col-xs-8 col-sm-6">
                <div class="radio-box">
                    <input type="radio" name="status" id="status-2" value="0" {$data.status==null && $data.status==0
                        ? 'checked' : "" }>
                    <label for="status-2">未审核</label>
                </div>
                <div class="radio-box">
                    <input type="radio" name="status" id="status-1" value="1" {$data.status!=null && $data.status==1
                        ? 'checked' : "" }>
                    <label for="typeId-1">已审核</label>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">备注：</label>
            <div class="formControls col-xs-8 col-sm-6">
                <textarea id="remark" name="remark" cols="" rows="" class="textarea" placeholder="备注...200个字符以内"
                    dragonfly="true" onKeyUp="textarealength(this,200)">{$data.remark}</textarea>
                <p class="textarea-numberbar">
                    <em class="textarea-length">0</em>/200
                </p>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-success radius" type="button" id="form-save-button" onclick="saveForm();"
                    value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                <input class="btn btn-default radius" type="button" value="&nbsp;&nbsp;取消&nbsp;&nbsp;"
                    onclick="layer_close();">
            </div>
        </div>
    </form>
</article>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    function saveForm() {
        if (getblen($("#remark").val()) > 200) {
            layer.msg('备注过长', {
                icon: 5,
                time: 1000
            });
            return false;
        }

        var data = $("#form-save").serializeArray();
        $.ajax({
            type: 'POST',
            url: '{:url("save")}',
            data: data,
            dataType: 'json',
            success: function (res) {
                // console.log(res);
                if (res.code == 0) {
                    layer.msg(res.msg, { icon: 1 }, function () {
                        parent.location.reload(); // 父页面刷新
                        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        parent.layer.close(index);
                    });
                } else {
                    layer.msg(res.msg, {
                        icon: 5,
                        time: 1000
                    });
                    return false;
                }
            }
        })
    }
</script>
<!--请在上方写此页面业务相关的脚本-->